#ifndef FLYWEIGHTFACTORY_H__
#define FLYWEIGHTFACTORY_H__

//include header
#include "Flyweight.h"
#include <map>

//using namespace
using namespace std;


namespace npFlyweight
{
    //class forward declaration

    class FlyweightFactory // class inheritance
    {
        //friend
        
        //embedded type
        
        private: FlyweightFactory();
        public: virtual ~FlyweightFactory();
        private: FlyweightFactory(const FlyweightFactory& cpy);
        private: FlyweightFactory& operator=(const FlyweightFactory& asn);
        private: FlyweightFactory(FlyweightFactory&& mov) noexcept;
        private: FlyweightFactory& operator=(FlyweightFactory&& mva) noexcept;
        private: virtual FlyweightFactory* clone() const;

        //other constructors

        //public methods
        public: Flyweight& getFlyweight(int n) const throw(out_of_range);

        //protected methods

        //private methods
        private: void clearFlyweights();

        //protected data

        //private data
        private: map<int, Flyweight*> flyweights;

        //others
        private: static const FlyweightFactory singleton;
        public: static const FlyweightFactory& getInst();
    };
} // namespace npFlyweight


#endif //FLYWEIGHTFACTORY_H__
